Zend: Fix method inheritance depending on the order of the interfaces - #23638
Open
lazerg wants to merge 1 commit into
Open
Zend: Fix method inheritance depending on the order of the interfaces#23638lazerg wants to merge 1 commit into
lazerg wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
interface C extends A, B {}fails whileinterface C extends B, A {}links, as soon as one parent carries a more specific signature than the other:When the child does not declare the method itself, the first parent's declaration is copied into its function table and every later parent is checked against that copy, so linking only works when the interface listed first happens to be the most specific one. Abstract classes are affected the same way.
The inherited method is now replaced when it is definitely not a valid override of a later parent while that parent is a valid override of it, which is the result the opposite order already produces. That is the approach nikic suggested in https://bugs.php.net/bug.php?id=76361. Only a definite error triggers it, so unresolved variance keeps the current behaviour, and signatures that genuinely conflict still fail in both orders.
Fixes #23630